A conventional virtual-machine monitor (VMM) typically runs on a computer and presents to other software the abstraction of one or more virtual machines. Each virtual machine may function as a self-contained platform, running its own “guest operating system” (i.e., an operating system (OS) hosted by the VMM) and other software, collectively referred to as guest software. The guest software expects to operate as if it were running on a dedicated computer rather than a virtual machine. That is, the guest software expects to control various events and have access to hardware resources. The hardware resources may include processor-resident resources (e.g., control registers), resources that reside in memory (e.g., descriptor tables) and resources that reside on the underlying hardware platform (e.g., input-output devices). The events may include interrupts, exceptions, platform events (e.g., initialization (INIT) or system management interrupts (SMIs)), etc.
In a virtual-machine environment, the VMM should be able to have ultimate control over these events and hardware resources to provide proper operation of guest software running on the virtual machines and for protection from and between guest software running on the virtual machines. To achieve this, the VMM typically receives control when guest software accesses a protected resource or when other events (such as interrupts or exceptions) occur.
For example, when a page fault (i.e., an exception associated with an address-translation operation) occurs during the operation of guest software, the control is transferred to the VMM which then determines whether the guest software or the VMM itself needs to handle the page fault. If the page fault needs to be handled by the guest software, the control is transferred back to the guest software. Because page faults (as well as other exceptions and interrupts) that do not need to be handled by the VMM occur rather frequently, there is a significant performance cost associated with such transitioning of control between the VMM and the guest software.